// 孙子组件
const BaseFocus = {
  inserted(el, binding) {
    el.focus = binding.value
  }
}
const BaseInput = {
  directives: {
    focus: BaseFocus
  },
  template: `<el-input v-model="input" :disabled="disabled" :type="type" :readonly="readonly" @change="onChange" @input="onInput" v-focus="focus"></el-input>`,
  props: {
    disabled: {
      type: Boolean,
      default: false
    },
    type: {
      type: String,
      default: 'text'
    },
    readonly: {
      type: Boolean,
      default: false
    },
  },
  methods: {
    onChange(v) {
      this.$emit('yeChange', v)
    },
    onInput(v) {
      this.$emit('yeInput', v)
    },
  }
}

export default BaseInput